package app;

import java.io.File;
import java.util.Properties;

import javax.swing.JFrame;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;

import KUtilities.KSpringOld;
import KUtilities.KSwing;

public class Main extends JFrame{

	private static final long serialVersionUID = 1L;

	JPanel background;
	Properties settings;
	public Main(){
		settings=new Properties();
		setTitle("SMS Desktop App");
		KSwing.setMainFrame(this);
		File iconFile=new File("lib"+File.separator+"images"+File.separator+"icon.png");
		KSwing.setIcon(iconFile);
		File img=new File("lib"+File.separator+"images"+File.separator+"background.jpg");
		background=KSwing.createBackGroundPanel(img, 450, 350);
		File f=new File("lib"+File.separator+"fonts"+File.separator+"Gill Sans.ttf");
		KSwing.setFont(f,2);
		createUI();
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		setVisible(true);
		KSwing.repack();
	}

	JLayeredPane main;
	JPanel mainPanel;
	KSpringOld mainSpring;
	SMSPanel smsPanel;
	ContactsPanel contactsPanel;
	private void createUI(){
		main=new JLayeredPane();
		mainSpring=new KSpringOld(main);
		mainSpring.addToCenter(background);
		add(main);
		mainPanel=new JPanel();
		mainPanel.setOpaque(false);
		
		smsPanel=new SMSPanel(main,mainSpring);
		contactsPanel=new ContactsPanel(smsPanel);
		setJMenuBar(new MenuBar(smsPanel));
		
		mainPanel.add(smsPanel);
		mainPanel.add(contactsPanel);
		mainSpring.addToCenter(mainPanel);
		KSwing.repack();
	}

	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable(){
			public void run(){
				KSwing.setDefaultLookAndFeel();
				new Main();
			}
		});
		
	}

}
